home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / db / esm-3.1 / esm-3 / usr / local / sm / src / serverlib / msg / initializeMsg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-05  |  3.3 KB  |  146 lines

  1. /*
  2.  *   $RCSfile: initializeMsg.c,v $  
  3.  *   $Revision: 1.1.1.1 $  
  4.  *   $Date: 1996/05/04 21:55:54 $      
  5.  */ 
  6. /**********************************************************************
  7. * EXODUS Database Toolkit Software
  8. * Copyright (c) 1991 Computer Sciences Department, University of
  9. *                    Wisconsin -- Madison
  10. * All Rights Reserved.
  11. *
  12. * Permission to use, copy, modify and distribute this software and its
  13. * documentation is hereby granted, provided that both the copyright
  14. * notice and this permission notice appear in all copies of the
  15. * software, derivative works or modified versions, and any portions
  16. * thereof, and that both notices appear in supporting documentation.
  17. *
  18. * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
  19. * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.  
  20. * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
  21. * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  22. *
  23. * The EXODUS Project Group requests users of this software to return 
  24. * any improvements or extensions that they make to:
  25. *
  26. *   EXODUS Project Group 
  27. *     c/o David J. DeWitt and Michael J. Carey
  28. *   Computer Sciences Department
  29. *   University of Wisconsin -- Madison
  30. *   Madison, WI 53706
  31. *
  32. *     or exodus@cs.wisc.edu
  33. *
  34. * In addition, the EXODUS Project Group requests that users grant the 
  35. * Computer Sciences Department rights to redistribute these changes.
  36. **********************************************************************/
  37. #include "sysdefs.h"
  38. #include "ess.h"
  39. #include "checking.h"
  40. #include "trace.h"
  41. #include "error.h"
  42. #include "list.h"
  43. #include "tid.h"
  44. #include "io.h"
  45. #include "lock.h"
  46. #include "object.h"
  47. #include "msgdefs.h"
  48. #include "thread.h"
  49. #include "semaphore.h"
  50. #include "adminmsg.h"
  51. #include "link.h"
  52. #include "host.h"
  53. #include "bitvec.h"
  54. #include "msgvector.h"
  55. #include "msg_funcs.h"
  56. #include "util_funcs.h"
  57. #include "msg_globals.h"
  58. #include "volume.h"
  59. #include "disk_globals.h"
  60. #include "sharedmem_globals.h"
  61. #include "queue_globals.h"
  62. #include "queue_consist.h"
  63. #include "server_util_funcs.h"
  64.  
  65.  void
  66. initializeMsg (
  67.     int        initConnect
  68. )
  69. {
  70.  
  71.     register int    i;
  72.  
  73.  
  74.     TRACE(TR_MSG, TR_LEVEL_1);
  75.  
  76.     /*
  77.      *    signal handling
  78.      */
  79. #ifdef __cplusplus
  80.     /* gcc typedefs SignalHandler instead of SIG_PF */
  81. #    if defined(__GNUC__) && !defined(SIG_PF)
  82. #        define SIG_PF SignalHandler
  83. #    endif
  84. #   ifdef hpux
  85.     signal(SIGPIPE, (void (*)(int)) pipeError);
  86. #   else
  87.     signal(SIGPIPE, (SIG_PF) pipeError);
  88. #   endif hpux
  89. #elif defined(mips)
  90.     signal(SIGPIPE, (PFI) pipeError);
  91. #else
  92.     /* bug in cpp includes everything listed here */
  93. #endif 
  94.  
  95.     /*
  96.      *    initilize the bit vectors
  97.      */
  98.     for (i = 0; i < BVL; i++)    {
  99.  
  100.         SelectMask.bv_data[i] = 0;
  101.         DiskMask.bv_data[i] = 0;
  102.         AllMask.bv_data[i] = 0;
  103.     }
  104.  
  105.     /*
  106.      *    initialize the Links
  107.      */
  108.     initializeLinks();
  109.  
  110.     /*
  111.      *    set initial receive conditions
  112.      */
  113.     SelectRestrict = FALSE;
  114.  
  115.     /*
  116.      *    initialize the message bufs
  117.      */
  118.     SM_ASSERT(LEVEL_1, (ShmDiskMessages!=NULL));
  119.     DiskMessages = (DISKMSG *)(ShmDiskMessages);
  120.  
  121.     /*
  122.      *    create the initial connection
  123.      */
  124.     if (initConnect)    {
  125.  
  126.         connectInitialize();
  127.  
  128.     }
  129.  
  130. }
  131.  
  132. void
  133. initializeStdin()
  134. {
  135.     /*
  136.      *    Set up link for standard input
  137.      */
  138.     SM_ASSERT(LEVEL_1, (fileno(stdin) != -1));
  139.     Links[fileno(stdin)].linkClass = CL_STDIN;
  140.     setLink(&(Links[fileno(stdin)]));
  141.  
  142.     if(isatty(fileno(stdin))) {
  143.         startuptty();
  144.     } 
  145. }
  146.